/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * NewJFrame.java
 *
 * Created on 11-jul-2009, 9:50:54
 */

package test;

import gamecore.GameCore;
import gamecore.clocks.GameClock;
import gamecore.clocks.GameClockSystemNanotime;

/**
 *
 * @author Administrador
 */
public class NewJFrame extends javax.swing.JFrame {

	private GameCore gameCore;
	private GameClock gameClock;

    /** Creates new form NewJFrame */
    public NewJFrame() {
        initComponents();
		gameClock = new GameClockSystemNanotime();
		gameCore = new MyCore(gameClock);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        btn_StartCore = new javax.swing.JButton();
        btn_StopCore = new javax.swing.JButton();
        btn_ResumeCore = new javax.swing.JButton();
        btn_PauseCore = new javax.swing.JButton();
        btn_StartGame = new javax.swing.JButton();
        btn_StopGame = new javax.swing.JButton();
        btn_ResumeGame = new javax.swing.JButton();
        btn_PauseGame = new javax.swing.JButton();
        btn_CoreInfoOn = new javax.swing.JButton();
        btn_CoreInfoOff = new javax.swing.JButton();
        btn_ClockInfoOn = new javax.swing.JButton();
        btn_ClockInfoOff = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        btn_StartCore.setText("Start Core");
        btn_StartCore.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_StartCoreActionPerformed(evt);
            }
        });

        btn_StopCore.setText("Stop Core");
        btn_StopCore.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_StopCoreActionPerformed(evt);
            }
        });

        btn_ResumeCore.setText("Resume Core");
        btn_ResumeCore.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_ResumeCoreActionPerformed(evt);
            }
        });

        btn_PauseCore.setText("Pause Core");
        btn_PauseCore.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_PauseCoreActionPerformed(evt);
            }
        });

        btn_StartGame.setText("Start Game");
        btn_StartGame.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_StartGameActionPerformed(evt);
            }
        });

        btn_StopGame.setText("Stop Game");
        btn_StopGame.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_StopGameActionPerformed(evt);
            }
        });

        btn_ResumeGame.setText("Resume Game");
        btn_ResumeGame.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_ResumeGameActionPerformed(evt);
            }
        });

        btn_PauseGame.setText("Pause Game");
        btn_PauseGame.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_PauseGameActionPerformed(evt);
            }
        });

        btn_CoreInfoOn.setText("Core Info On");
        btn_CoreInfoOn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_CoreInfoOnActionPerformed(evt);
            }
        });

        btn_CoreInfoOff.setText("Core Info Off");
        btn_CoreInfoOff.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_CoreInfoOffActionPerformed(evt);
            }
        });

        btn_ClockInfoOn.setText("Clock Info On");
        btn_ClockInfoOn.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_ClockInfoOnActionPerformed(evt);
            }
        });

        btn_ClockInfoOff.setText("Clock Info Off");
        btn_ClockInfoOff.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btn_ClockInfoOffActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btn_StartCore, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btn_ResumeCore, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btn_StartGame, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btn_ResumeGame, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btn_StopCore, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btn_PauseCore, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btn_StopGame, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btn_PauseGame, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(39, 39, 39)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(btn_CoreInfoOn, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(btn_ClockInfoOn, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                    .addComponent(btn_ClockInfoOff)
                    .addComponent(btn_CoreInfoOff, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addGap(18, 18, 18))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_StartCore)
                    .addComponent(btn_StopCore)
                    .addComponent(btn_CoreInfoOn)
                    .addComponent(btn_CoreInfoOff))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_ResumeCore)
                    .addComponent(btn_PauseCore)
                    .addComponent(btn_ClockInfoOn)
                    .addComponent(btn_ClockInfoOff))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_StartGame)
                    .addComponent(btn_StopGame))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btn_ResumeGame)
                    .addComponent(btn_PauseGame))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

	private void btn_StartCoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_StartCoreActionPerformed
		gameCore.startCore();
	}//GEN-LAST:event_btn_StartCoreActionPerformed

	private void btn_StopCoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_StopCoreActionPerformed
		gameCore.stopCore();
	}//GEN-LAST:event_btn_StopCoreActionPerformed

	private void btn_ResumeCoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_ResumeCoreActionPerformed
		gameCore.resumeCore();
	}//GEN-LAST:event_btn_ResumeCoreActionPerformed

	private void btn_PauseCoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_PauseCoreActionPerformed
		gameCore.pauseCore();
	}//GEN-LAST:event_btn_PauseCoreActionPerformed

	private void btn_StartGameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_StartGameActionPerformed
		gameCore.startGame();
	}//GEN-LAST:event_btn_StartGameActionPerformed

	private void btn_StopGameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_StopGameActionPerformed
		gameCore.stopGame();
	}//GEN-LAST:event_btn_StopGameActionPerformed

	private void btn_ResumeGameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_ResumeGameActionPerformed
		gameCore.resumeGame();
	}//GEN-LAST:event_btn_ResumeGameActionPerformed

	private void btn_PauseGameActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_PauseGameActionPerformed
		gameCore.pauseGame();
	}//GEN-LAST:event_btn_PauseGameActionPerformed

	private void btn_CoreInfoOnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_CoreInfoOnActionPerformed
		((MyCore)gameCore).mostrar = true;
	}//GEN-LAST:event_btn_CoreInfoOnActionPerformed

	private void btn_CoreInfoOffActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_CoreInfoOffActionPerformed
		((MyCore)gameCore).mostrar = false;
	}//GEN-LAST:event_btn_CoreInfoOffActionPerformed

	private void btn_ClockInfoOnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_ClockInfoOnActionPerformed
		gameCore.enableStadistics();
	}//GEN-LAST:event_btn_ClockInfoOnActionPerformed

	private void btn_ClockInfoOffActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btn_ClockInfoOffActionPerformed
		gameCore.disableStadistics();
	}//GEN-LAST:event_btn_ClockInfoOffActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new NewJFrame().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btn_ClockInfoOff;
    private javax.swing.JButton btn_ClockInfoOn;
    private javax.swing.JButton btn_CoreInfoOff;
    private javax.swing.JButton btn_CoreInfoOn;
    private javax.swing.JButton btn_PauseCore;
    private javax.swing.JButton btn_PauseGame;
    private javax.swing.JButton btn_ResumeCore;
    private javax.swing.JButton btn_ResumeGame;
    private javax.swing.JButton btn_StartCore;
    private javax.swing.JButton btn_StartGame;
    private javax.swing.JButton btn_StopCore;
    private javax.swing.JButton btn_StopGame;
    // End of variables declaration//GEN-END:variables

}
